﻿/**
 * Hot Topic : 실시간 검색어 조회 서비스
 * http://dev.naver.com/openapi/apis/search/rank
 * 
 */

using NaverOpenApiLibrary.Models;
using System.Collections.Generic;

namespace NaverOpenApiLibrary.Services
{
    /// <summary>
    /// Service returns trendy hot topics
    /// for more info: http://dev.naver.com/openapi/apis/search/rank
    /// </summary>
    public class HotTopicsService : NaverApiService<HotTopicsWrapper>
    {
        // uri pattern : http://openapi.naver.com/search?key={0}&query=nexearch&target=rank
        protected const string URL_HOT_TOPIC_SERVICE = "http://openapi.naver.com/search";

        public HotTopicsService(string apiKey)
            : base(apiKey, URL_HOT_TOPIC_SERVICE)
        { 
            // do nothing...
        }

        public void GetHotTopics() 
        {
            base.DoApiService();
        }

        protected override IDictionary<string, string> GetApiUriParameters()
        {
            return new Dictionary<string, string>() {
                {"query", "nexearch"},
                {"target", "rank"}
            };
        }

        protected override HotTopicsWrapper Deserialize(string rawData)
        {
            return base.ParseXmlResult(rawData);
        }
    }
}
